package com.jasonjan.jiance.module.search.main;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.jasonjan.jiance.R;

/**
 * Created by JasonJan on 2017/12/1.
 */

public class SearchTabLayout extends Fragment {
    private static SearchTabLayout instance = null;

    private TextView scoreSearch;
    private TextView feeSearch;
    private TextView examSearch;
    private TextView lessonSearch;
    private TextView testSearch;


    public static SearchTabLayout getInstance() {
        if (instance == null) {
            instance = new SearchTabLayout();
        }
        return instance;
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_video_tab, container, false);
        initView(view);
        return view;
    }

    @Override
    public void onResume() {
        super.onResume();

    }

    private void initView(View view) {
        scoreSearch=view.findViewById(R.id.scoreSearch);
        feeSearch=view.findViewById(R.id.feeSearch);
        examSearch=view.findViewById(R.id.examSearch);
        lessonSearch=view.findViewById(R.id.lessonSearch);
        testSearch=view.findViewById(R.id.testSearch);

        scoreSearch.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v){
                SearchActivity.launch("scoreSearch");
            }
        });

        feeSearch.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v){
                SearchActivity.launch("feeSearch");
            }
        });

        examSearch.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v){
                SearchActivity.launch("examSearch");
            }
        });

        lessonSearch.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v){
                SearchLessonActivity.launch("lesson");
            }
        });

        testSearch.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v){
                TestSearchActivity.launch("test");
            }
        });
    }


    @Override
    public void onDestroy() {
        if (instance != null) {
            instance = null;
        }
        super.onDestroy();
    }
}
